﻿@model IEnumerable<Pescar2013Shop_MaruMati.Controllers.Producto>

@{
    ViewBag.Title = "Administración";
}
<html><head><title>@ViewBag.Title</title></head><body style="background-image: 
url(http://images2.fanpop.com/image/photos/14100000/Orange-M-M-wallpaper-m-and-ms-14194351-1440-900.jpg)">
<h2></h2>

<p>
    @Html.ActionLink("Ingresa un nuevo producto", "Create")
</p>
<p>
   <a href= "/Marca">Ir a Listado De Marcas</a>
</p>

<form class="form-search">
<label>
    <span>Buscar producto por nombre: </span>
    <input type="text" name="term" class="input-medium search-query"/>
      <button type="submit" class="btn btn-blue">Buscar</button>
</label>
</form>

<table class="table table-bordered" style="background-color:rgba(255, 255, 255, 0.85)">
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.Nombre)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Modelo)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Precio)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Descripcion)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Url)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Marca.nombre)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Marca.descripcion)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Marca.foto)
        </th>
       
        

        <th></th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            <a href="~/Producto/Index/@item.id" target="_blank">
            @Html.DisplayFor(modelItem => item.Nombre)</a>
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Modelo)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Precio)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Descripcion)
        </td>
        <td>
       @if (item.Url != null) {
           <img src="@Html.DisplayFor(modelItem => item.Url)" height="200" width="200"/>
       } else {
                <img src="@Url.Content("~/Content/productos/" + item.id + ".jpg")" height="150" width="150"/>
            }
        </td>
       <td>
                <a href="~/Marca/Details/@item.Marca.id" target="_new">
                @Html.DisplayFor(modelItem => item.Marca.nombre)
                      </a>
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Marca.descripcion)
        </td>
         <td>
             <img src="@Html.DisplayFor(modelItem => item.Marca.foto)" height="200" width="200"/>
        </td>

        <td>
            <div class="btn-group">
            <a class="btn btn-warning" data-toggle="dropdown">Opciones<span class="caret"></span></a>
            <ul class="dropdown-menu">
            <li>@Html.ActionLink("Editar", "Edit", new { id=item.id })</li>
            <li>@Html.ActionLink("Ver detalles", "Details", new { id=item.id })</li>
            <li>@Html.ActionLink("Eliminar", "Delete", new { id=item.id })</li>
            </ul>
</div>
    
        </td>
    </tr>
}

</table>
    </body></html>